HTML <article> tag

The <article> tag is a semantic tag that describes its meaning to both the developer and the browser. It specifies independent, self-contained content that doesn’t require any other context. An article makes sense on its own and can be distributed independently from the rest of the website. These tags are perfect for presenting Microdata information.

The <article> tag is mostly used in two contexts: on a page consisting of only one piece of content, and on a page such as a search results page or a blog index page, where multiple <article> elements are used to contain individual pieces of content.

Some potential sources for article elements can be:

  • Blog entry
  • Comment submitted by a user
  • Newspaper/Magazine article
  • Forum Post

Note:  The article element does not render anything special in a browser. By default, the article element is of block-level.

The article is mostly used in two contexts :

  1. On a page consisting of only one piece of content, a single <article> element is used to contain the main content and separate it off from rest of the page.
  2. On a page such as a search results page, a blog index page etc, multiple <article> elements are used to contain individual pieces of content.

Example: This example shows the use case of the <article> tag on our web page.

HTML
<!DOCTYPE html>
<html>

<head>
    
    <style>
        article {
            background-color: rgb(236, 233, 233);
            width: 300px;
            border: 2px solid black;
            padding: 5px;
            border-radius: 10px;
            margin: auto;
            box-sizing: border-box;
        }        
        img {
            height: 150px;
            width: 150px;
        }
    </style>
</head>

<body>
    <article>
        <img src=
"https://media.w3wiki.org/wp-content/uploads/20220120191044/logo-200x145.png" 
             alt="GfG Logo">
        <h1>w3wiki</h1>

        <p>
            A Computer Science portal for geeks. 
            It contains well written, well thought 
            and well-explained computer science 
            and programming articles, quizzes, 
            and live courses
        </p>
    </article>
</body>

</html>

Output:

Differentiate between , & tags in HTML

HTML is a language full of diverse elements, and three such elements are the <article><p>, and <section> tags. These semantic tags, while similar, each have unique uses and meanings within an HTML document.

The article tag is used for the independent content, p tag for paragraph and section for different section of the document.

Tags in HTML are keywords where every specific single tag has some unique meaning.

Similar Reads

HTML

HTML

tag

The 

 tag, standing for ‘paragraph’, defines paragraphs in HTML. Anything written within 

 and 

 is treated as a paragraph. The browser automatically adds space (a single blank line) before and after each 

 element, which is simply margins added by the browser. Multiple lines and spaces added by the users are reduced to a single space by the browser. The 

 tag is most useful when there are multiple paragraphs to be added in articles, stories, etc....

HTML

tag

The 

 tag defines sections in a document, such as chapters, headers, footers, or any other sections of the document. It’s used to split a page into sections like Introduction, Contact Information, Details, etc., and each of these sections can be in a different 
 tag. The 
 tag is introduced to wrap up things in a particular section. The 
 tag divides the content into sections and subsections....

Difference between

tag,

tag &

tag in HTML:

tag                                      

tag                         

tag      Article tag is a semantic tag. Paragraph is presentational and semantic tag. Section tag is a semantic tag. When to use: Blog articleNewspapers/ Magazines articleForum PostWhen to use: Adding multiple paragraphs in articles, stories, informative blogs.When to use: Adding multiple headers or sections in a document.Default CSS display property is               “Block”Default CSS display property is “Block”                       Default CSS display property is “Block”...